package cn.jasonone.controller;

import cn.jasonone.model.PdfContent;
import cn.jasonone.views.PdfView;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.Map;

/**
 * 导出PDF
 * @author xujie
 * @version 1.0.0
 */
@Controller
@RequestMapping("/export/pdf")
public class PdfController {
    private PdfContent content;

    @GetMapping
    public PdfView home(){
        return new PdfView(content);
    }

    @PutMapping
    @ResponseBody
    public Map<String,Object> save(@RequestBody PdfContent pdfContent){
        this.content = pdfContent;
        System.out.println("this.content = " + this.content);
        Map<String,Object> map = new HashMap<>();
        map.put("code",0);
        return map;
    }

}
